<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('资产交易明细')"/>
    <th:block th:include="include :: layout-latest-css"/>
    <th:block th:include="include :: ztree-css"/>
</head>
<body class="gray-bg">
<div class="ui-layout-center">
    <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="user-form">
                    <div class="select-list">
                        <ul>
                            <li>
                                资产名称：<input type="text" name="assetName"/>
                            </li>
                            <li>
                                资产类型：
                                <select name="typeName">
                                    <option value="">所有</option>
                                    <option value="股票基金">股票基金</option>
                                    <option value="债券基金">债券基金</option>
                                    <option value="固定收益">固定收益</option>
                                    <option value="货币基金">货币基金</option>
                                    <option value="股票">股票</option>
                                </select>
                            </li>
                            <li class="select-time">
                                <label>操作日期： </label>
                                <input type="text" class="time-input" id="startTime" placeholder="开始时间"
                                       name="startDate"/>
                                <span>-</span>
                                <input type="text" class="time-input" id="endTime" placeholder="结束时间"
                                       name="endDate"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                        class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="resetPre()"><i
                                        class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<th:block th:include="include :: layout-latest-js"/>
<th:block th:include="include :: ztree-js"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('system:user:edit')}]];
    var removeFlag = [[${@permission.hasPermi('system:user:remove')}]];
    var resetPwdFlag = [[${@permission.hasPermi('system:user:resetPwd')}]];
    var prefix = ctx + "finance/tradeDetail";

    $(function () {
        var panehHidden = false;
        if ($(this).width() < 769) {
            panehHidden = true;
        }
        $('body').layout({initClosed: panehHidden, west__size: 185, resizeWithWindow: false});
        // 回到顶部绑定
        if ($.fn.toTop !== undefined) {
            var opt = {
                win: $('.ui-layout-center'),
                doc: $('.ui-layout-center')
            };
            $('#scroll-up').toTop(opt);
        }
        queryUserList();
        queryDeptTree();
    });

    function queryUserList() {
        var options = {
            url: prefix + "/list",
            sortName: "createTime",
            sortOrder: "desc",
            modalName: "资产",
            columns: [
                {field: 'tradeTime', title: '操作日期'},
                {field: 'typeName', title: '类型'},
                {field: 'assetName', title: '资产名称'},
                {
                    field: 'direction', title: '操作',
                    formatter: function (value, row, index) {
                        if (value == '买入') {
                            return "<span class='badge-primary'>" + value + "</span>";
                        } else {
                            return "<span class='badge-danger'>" + value + "</span>";
                        }
                    }
                },
                {field: 'numberOf', title: '交易份额'},
                {field: 'amount', title: '金额'},
                {field: 'remark', title: '备注'}
            ]
        };
        $.table.init(options);
    }

    /* 自定义重置-表单重置/隐藏框/树节点选择色/搜索 */
    function resetPre() {
        resetDate();
        $("#user-form")[0].reset();
        $("#deptId").val("");
        $("#parentId").val("");
        $(".curSelectedNode").removeClass("curSelectedNode");
        $.table.search();
    }

</script>
</body>
</html>